export default function cancelEdit() {
    const {
        lastAgreementPage, lastContractPage, tabKey, contractArea,
        agreeArea, isQueryTemplate, agreementPageInfo
    } = this.state;
    if (tabKey === 'contract') {
        this.props.form.cancel(contractArea);
        this.setState({
            contractPage: lastContractPage
        }, () => {
            this.updateButtonStatus();
        })
    } else {
        if (lastAgreementPage === 'main') {
            this.setState({
                agreementPageInfo: {...agreementPageInfo, pageIndex: 1},
                agreementPage: lastAgreementPage
            }, () => {
                this.updateButtonStatus();
                this.getAgreeTableData(isQueryTemplate)
            })
        } else {
            this.props.form.cancel(agreeArea);
            this.setState({
                agreementPage: lastAgreementPage
            }, () => {
                this.updateButtonStatus();
            })
        }
    }
}
